<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
    //    window.onload=function() {
    //     const oul=document.querySelector('.list')
    //      console.log(oul.nodeType)
    //    }

    // window.addEventListener('DOMContentLoaded',function(){
    //     const oul=document.querySelector('.list')
    //      console.log(oul.nodeType)
    // },false)
    </script>
</head>
<body>
    <h2>dom操作</h2>
    <!-- <button class="btn">克隆ul</button> -->
    <button class="btn">追加1000条li</button>
    <ul class="list">
        <!-- <li>item1</li>
        <li>item2</li>
        <li>item3</li>
        <li>item4</li>
        <li>item5</li>
        <li>item6</li> -->
    </ul>
</body>
<script>
    // function $(dom) {
    //     return  document.querySelector(dom)
    // }
   window.onload=function() {
      const oul=document.querySelector('.list')
    const odiv=document.createElement('div')
    const oimg=document.createElement('img')
    oimg.src='https://img2.baidu.com/it/u=996777983,2758962499&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500'
    odiv.textContent='2302A'
   // console.log(odiv)
   //document.body.appendChild(odiv)
  // document.body.insertBefore(odiv,oul)
  // document.body.appendChild(oimg)

   const btn=document.querySelector('.btn')
   btn.addEventListener('click',function() {
     const copyUL=oul.cloneNode(true)
     console.log('copyUL:',copyUL)
     document.body.appendChild(copyUL)
   },false)

   
   }

</script>
</html>